import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TaskTypeVO, TaskTypeForm, TaskTypeQuery } from '@/api/task/taskType/types';

/**
 * 查询任务类型列表
 * @param query
 * @returns {*}
 */

export const listTaskType = (query?: TaskTypeQuery): AxiosPromise<TaskTypeVO[]> => {
  return request({
    url: '/oa/taskType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询任务类型详细
 * @param id
 */
export const getTaskType = (id: string | number): AxiosPromise<TaskTypeVO> => {
  return request({
    url: '/oa/taskType/' + id,
    method: 'get'
  });
};

/**
 * 新增任务类型
 * @param data
 */
export const addTaskType = (data: TaskTypeForm) => {
  return request({
    url: '/oa/taskType',
    method: 'post',
    data: data
  });
};

/**
 * 修改任务类型
 * @param data
 */
export const updateTaskType = (data: TaskTypeForm) => {
  return request({
    url: '/oa/taskType',
    method: 'put',
    data: data
  });
};

/**
 * 删除任务类型
 * @param id
 */
export const delTaskType = (id: string | number | Array<string | number>) => {
  return request({
    url: '/oa/taskType/' + id,
    method: 'delete'
  });
};
